import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // 用户信息
    userInfo: '',
    // 定义一个用户登录状态
    isLogin: false,
    // 保存当前频道
    ChannelNum: 0
  },
  mutations: {
    setUserInfo (state, value) {
      state.userInfo = value
    },
    setIsLogin (state, value) {
      state.isLogin = value
    },
    setChannelNum (state, value) {
      state.ChannelNum = value
    }
  },
  getters: {
    getuserInfo (state) {
      return state.userInfo
    },
    getChannelNum (state) {
      return state.ChannelNum
    }
  },
  actions: {},
  modules: {}
})
